package Vistas;

import java.util.ArrayList;

import javax.swing.table.AbstractTableModel;

import Modelo.Equipo;
import Modelo.Partido;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaConsultarModeloTablaPosiciones extends AbstractTableModel {

	private static String[] titulos = {"Posicion","Equipo","Jugados","Ganados","Perdidos"};
	
	private ArrayList<Equipo> equipos;
	
	public VentanaConsultarModeloTablaPosiciones(ArrayList<Equipo> equipos) {
		super();
		// TODO Auto-generated constructor stub
		this.equipos=equipos;
	}

	@Override
	public int getColumnCount() {
		// TODO Auto-generated method stub
		return titulos.length;
	}

	@Override
	public int getRowCount() {
		// TODO Auto-generated method stub
		return equipos.size();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Equipo e  = equipos.get(rowIndex);
				
		switch (columnIndex){
			case 0: return rowIndex + 1;
			case 1: return e.getNombre();
			case 2: return e.getJuegosJugados();
			case 3: return e.getJuegosGanados();
			case 4: return e.getJuegosPerdidos();
		}
		return null;
	}
	
	@Override
	public String getColumnName(int column) {
		return titulos[column];
	}
	
	private void initGUI() {
		try {
			{
				this.setSize(582, 381);
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private void setSize(int i, int j) {
		// TODO Auto-generated method stub
		
	}

}
